<template>
  <router-view />
</template>
<style lang="scss" scoped></style>
<script>
export default {
  created() {
    this.setFontSize(document, window);
  },
  methods: {
    setFontSize(doc, win) {
      let docEl = doc.documentElement;
      let resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
      let reCaculate = function() {
        let clientWidth = docEl.clientWidth;
        if (!clientWidth) {
          return;
        }
        docEl.style.fontSize = 20 * (clientWidth / 1920) + 'px';
      };
      if (!doc.addEventListener) {
        return;
      }
      win.addEventListener(resizeEvt, reCaculate, false);
      doc.addEventListener('DOMContentLoaded', reCaculate, false);
    }
  }
};
</script>
